package com.lottery.ruok.lottrey.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.lottery.ruok.lottrey.fragment.BaseFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by ASUS on 2017/10/18.
 */

public class ViewPagerTitleAdapter extends FragmentPagerAdapter {//供basefragment使用并且需要设置title的viewpager可以使用的adapter
    private List<BaseFragment> mViewList;
    private String[] getWholeCategoryResponses;

    public ViewPagerTitleAdapter(FragmentManager fragmentManager, ArrayList<BaseFragment> mViewList, String[] getWholeCategoryResponses) {
        super(fragmentManager);
        this.mViewList = mViewList;
        this.getWholeCategoryResponses = getWholeCategoryResponses;
    }

    @Override
    public Fragment getItem(int position) {
        return mViewList.get(position);
    }

    @Override
    public int getCount() {
        return mViewList.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return getWholeCategoryResponses[position];
    }
}
